<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <!-- import CSS -->
    <link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.15.9/theme-chalk/index.css">
    <style>        #app {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: #f5f7fa;
    }
    .form-container {
        width: 400px;
        padding: 20px;
        background-color: white;
        border-radius: 8px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    }
    </style>
</head>
<body>
<div id="app">
    <div class="form-container">
        <el-input type="textarea" :rows="4" placeholder="说点儿啥..." v-model="weibo.content" style="width: 100%;"></el-input>
        <el-button type="primary" style="width: 100%;" @click="insert()">发微博</el-button>
    </div>
</div>
<!--引入axios和vue框架文件-->
<script src="https://cdn.bootcss.com/axios/0.18.0/axios.min.js"></script>
<!-- import Vue before Element -->
<script src="https://cdn.staticfile.org/vue/2.6.14/vue.min.js"></script>
<!-- import JavaScript -->
<script src="https://cdn.staticfile.org/element-ui/2.15.9/index.min.js"></script>
<script>    let v = new Vue({
    el: '#app',
    data: function () {
        return {
            dialogImageUrl: '',
            dialogVisible: false,
            weibo: { content: "" },
            fileList: []
        }
    },
    methods: {
        insert() {
            // 发出发微博的请求
            axios.post("/v1/weibo/insert", this.weibo).then(function (response) {
                if (response.data === 1) {
                    location.href = "/";
                } else {
                    alert("请先登录!");
                    location.href = "/login.html";
                }
            });
        }
    }
});
</script>
</body>
</html>